package club.cearnach.api.service;

import club.cearnach.entity.Admin;
import club.cearnach.api.exception.AdminException;
import club.cearnach.api.exception.RoleNotFoundException;
import club.cearnach.api.form.PageBean;
import club.cearnach.security.enumeration.RoleEnum;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Optional;


/**
 * @author 阮胜
 * @date 2018/5/13 23:29
 */
public interface IAdminService {
    void delete(Integer id) throws AdminException;

    Admin save(Admin admin);

    Admin find(String account, String password) throws AdminException;

    Optional<Admin> findByAccount(String account);

    Optional<Admin> findByAccountAndPrivilege(String account, RoleEnum roleEnum) throws RoleNotFoundException;

    Admin find(Integer id) throws AdminException;

    Admin find(Admin admin) throws AdminException;

    Page<Admin> findAllOrderByCreateDate(PageBean pageBean);

    Page<Admin> findAll(Pageable pageable);


    List<Admin> findByIdIn(Integer... ids);

    void deleteIn(Integer... ids);

    long count();

    boolean isExist(String account, Integer id);

    Optional<Admin> login(String account, String pwd);

    Page<Admin> findByLastLoginDate();
}
